/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ducas.getprice.db;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

/**
 *
 * @author Administrator
 */
public class JDBCClient {
    DataAccessObject obj = new DataAccessObject();
    
    public void getCustomerInfo(){
       ResultSet rs=null;
       String sSQL="select login, name, id, balance from mt4_users where login like '10121%'";
       try {
           Statement s = obj.getConnection().createStatement();
           rs=s.executeQuery(sSQL);
//           System.out.format("%10s %-40s %-12s %-20%n", "LOGIN", "NAME", "ID", "BALANCE");
//           System.out.format("%10s %-40s %-12s %-20%n", "-----", "----", "--", "-------");
           
           while(rs.next()){
               long login=rs.getLong("login");
               String name=rs.getString("name");
               long id=rs.getLong("id");
               long balance=rs.getLong("balance");
//               System.out.format("%10s %-40s %-12s %-20%n", login, name, id, balance);
               System.out.println(login+"\t"+name+"\t\t\t\t"+id+"\t"+balance);
           }
           
       } catch (SQLException e) {
           System.out.println(e.getMessage());
           System.exit(-1);
       }
   }
    
    public static void main(String[] args){
        new JDBCClient().getCustomerInfo();
        
    }
}
